package com.car.carsharing.dto;


import java.io.Serializable;
import java.util.List;

public class TableListDto implements Serializable {

    private List<?> rows;

    private Long  total;

    private String msg;

    private int code;

    public List<?> getRows() {
        return rows;
    }

    public void setRows(List<?> rows) {
        this.rows = rows;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public TableListDto sucess(List<?> rows, String msg){
        this.code = 1;
        this.rows = rows;
        this.msg = msg ;
        return this;
    }

    public TableListDto sucess(List<?> rows, String msg,Long total){
        this.code = 1;
        this.rows = rows;
        this.msg = msg ;
        this.total = total;
        return this;
    }

    public TableListDto  error(String msg){
        this.code = 0;
        this.rows = rows;
        this.msg = msg ;
        return this;
    }
}
